<?php
/**
 * Core_Data_Newsession
 * new session initialise
 * 
 * @author Adrian Stolarski
 */
class Core_Data_Newsession implements Core_Data_Sessioninitialisable {
    
    /**
     *
     * @var type $database
     * database handler
     */
    public $database;
    
    /**
     * constructor()
     */
    public function __construct() {
        $this->database = new Core_Driver_MysqlImproved;
    }
    
    public function session_init($value = null) {
        $this->database->connect();
        $value = $this->database->escape($value);
        $this->database->prepare(
                "SELECT * FROM user_object WHERE id=".$value.";"
                );
        $this->database->query();
        $session_data = $this->database->fetch('array');
        $_SESSION = $session_data;
    }

}
